﻿@model mesoBoard.Data.User


@if(false){ 
<script language="javascript" type="text/javascript" src="../../Content/jquery-1.3.2.min-vsdoc.js">
</script>
} 
	
@{ UserProfile userProfile = Model.UserProfile; }  
<script type="text/javascript" language="javascript">
    var selected = "selected";
    var notselected = "";
    var linkContainer = "#admin_tab_links";
    var linkChildren = "tab_link";
    var parentContainer = "#admin_tabs";
    var children = "tab";

    function showTab(tabid, item) {
        if ($("#" + tabid).is(":hidden")) {
            $(parentContainer).children().hide();
            $("#" + tabid).show();
            $("#tab_links_menu li").removeClass("selected");
            item.addClass("selected");
        }
    }
    $(function () {
        $("#userinfo").hide();
        showTab("userinfo", $("#tab_links_menu li.userinfo"));
        $("#tab_links_menu li").click(function () {
            //alert($(this).attr("id"));
            showTab($(this).attr("class"), $(this));
        });
        $("#tabs").tabs();

    });

</script>
    
<div class="users section">
    <h2>User Details: @Model.Username</h2>

    <div id="tabs">
	    <ul>
		    <li><a href="#accountinfo">Account Information</a></li>
		    <li><a href="#profile">Profile</a></li>
		    <li><a href="#roles">Roles</a></li>
	    </ul>
	    <div id="accountinfo">
            <dl class="details">
                <dt>ID</dt>
                <dd>@Model.UserID | @Html.AdminConfirm("Delete User", Url.Action("DeleteUser", new { UserID = Model.UserID }), Url.Action("UserDetails", new { UserID = Model.UserID }), null)</dd>
                    
                <dt>Username</dt>
                <dd>@Model.Username </dd>

                <dt>Email</dt>
                <dd>@Model.Email </dd>

                <dt>Status</dt>
                <dd>
                    @if (string.IsNullOrWhiteSpace(Model.ActivationCode))
                    {
                        <span class="active">Active</span>
                    }
                    else
                    {
                        <span class="inactive">Inactive</span>
                    }
                    @Html.ActionLink("(Change)", "ChangeUserStatus", new { UserID = Model.UserID })
                </dd>

                <dt>Joined</dt>
                <dd>@Model.RegisterDate  from @Model.RegisterIP </dd>

                <dt>Last Login</dt>
                <dd>@Model.LastLoginDate  from @Model.LastLoginIP </dd>
            </dl>
	    </div>
	    <div id="profile">
            <dl class="details">
                <dt>Avatar</dt>
                <dd>@Html.UserAvatar(Model.UserID) </dd>
                    
                <dt>Signature</dt>
                <dd>@Html.Raw(userProfile.ParsedSignature)</dd>

                <dt>Location</dt>
                <dd>@userProfile.Location </dd>

                <dt>Birthdate</dt>
                <dd>@(userProfile.Birthdate.HasValue ? userProfile.Birthdate.Value.ToShortDateString() : "(Not set)")</dd>

                <dt>Always Show Signature</dt>
                <dd>@userProfile.AlwaysShowSignature </dd>
            </dl>
	    </div>
	    <div id="roles">
            <dl class="details">
                <dt>Roles</dt>
                <dd>
                    <ul style="list-style: none; padding: 0;">
                    @{ foreach (var s in Model.InRoles)
                       {     
                        <li>
                            @Html.ActionLink("Remove", "RemoveFromRole", "Roles", new { UserID = s.UserID, RoleID = s.RoleID }, null) | @s.Role.Name 
                        </li>
                    } }
                    </ul>
                </dd>
            </dl>
	    </div>
    </div>
        
</div>